<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <base data-ice="baseUrl">
  <title data-ice="title">Home | amd-bundle</title>
  <link type="text/css" rel="stylesheet" href="css/style.css">
  <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
  <script src="script/prettify/prettify.js"></script>
  <script src="script/manual.js"></script>
<meta name="description" content="A dual-use tool for bundling up AMD modules, which is much easier to use than r.js with Almond or AMDclean"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="amd-bundle"><meta property="twitter:description" content="A dual-use tool for bundling up AMD modules, which is much easier to use than r.js with Almond or AMDclean"></head>
<body class="layout-container" data-ice="rootContainer">

<header>
  <a href="./">Home</a>
  
  <a href="identifiers.html">Reference</a>
  <a href="source.html">Source</a>
  <a href="test.html" data-ice="testLink">Test</a>
  <div class="search-box">
  <span>
    <img src="./image/search.png">
    <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
  </span>
    <ul class="search-result"></ul>
  </div>
<a style="position:relative; top:3px;" href="https://github.com/TechQuery/AMD_bundle.js"><img width="20px" src="./image/github.png"></a></header>

<nav class="navigation" data-ice="nav"><div>
  <ul>
    
  <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/source/Module.js~Module.html">Module</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/source/Package.js~Package.html">Package</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-generate">generate</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getNPMFile">getNPMFile</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getNPMIndex">getNPMIndex</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getNPMPackage">getNPMPackage</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-merge">merge</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-outPackage">outPackage</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-DependencyMap">DependencyMap</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-NameMap">NameMap</a></span></span></li>
</ul>
</div>
</nav>

<div class="content" data-ice="content"><div data-ice="index" class="github-markdown"><h1 id="amd-bundle">AMD bundle</h1><p><strong>A multiple-use tool for bundling up <a href="https://github.com/amdjs/amdjs-api/blob/master/AMD.md">AMD</a>, <a href="http://wiki.commonjs.org/wiki/Modules">CJS</a> &amp; ES 6 modules</strong>,
which is much easier to use than <a href="https://github.com/requirejs/r.js"><code>r.js</code></a> with <a href="https://github.com/requirejs/almond">Almond</a> or <a href="https://github.com/gfranko/amdclean">AMDclean</a>.</p>
<p><a href="https://david-dm.org/TechQuery/AMD_bundle.js"><img src="https://david-dm.org/TechQuery/AMD_bundle.js.svg" alt="NPM Dependency"></a></p>
<p><a href="https://nodei.co/npm/amd-bundle/"><img src="https://nodei.co/npm/amd-bundle.png?downloads=true&amp;downloadRank=true&amp;stars=true" alt="NPM"></a></p>
<h2 id="recommended-usage">Recommended Usage</h2><h3 id="basic">Basic</h3><pre><code class="lang-Shell"><code class="source-code prettyprint">cd path/to/project/root

npm install amd-bundle --save-dev

amd-bundle -a -m \
    path/to/project/source/entry \
    path/to/project/bundle/file</code>
</code></pre>
<p><code>amd-bundle</code> will</p>
<ol>
<li><p>start bundling from the entry point <code>path/to/project/source/entry.js</code></p>
</li>
<li><p>write into <code>path/to/project/bundle/file.js</code> with only one <code>define(&apos;file&apos;, [ ])</code> and <code>global.file</code> definition, just like <a href="https://github.com/umdjs/umd">UMD</a> style</p>
</li>
<li><p>treat <code>${process.cwd()}/node_modules/${module_full_name}</code> as a user&apos;s module to pack in</p>
</li>
<li><p>generate <code>file.min.js</code> &amp; <code>file.js.map</code> in <code>path/to/project/bundle/</code></p>
</li>
</ol>
<h3 id="more-options">More options</h3><h4 id="command-line">Command-line</h4><p><code>amd-bundle --help</code></p>
<pre><code><code class="source-code prettyprint">Usage: amd-bundle [options] &lt;entry file&gt; [bundle file]

Options:

    -V, --version      output the version number
    -a, --include-all  Bundle all dependencies (include those in &quot;./node_modules/&quot;)
    -m, --minify       Generate minified source code &amp; source map
    -s, --std-out      Write into &quot;stdout&quot; without logs
    -h, --help         output usage information</code>
</code></pre><h4 id="configuration">Configuration</h4><p><a href="https://github.com/TechQuery/AMD_bundle.js/blob/master/package.json#L75">Example</a></p>
<p>Key/value of option <code>moduleMap</code> is same as <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Parameters">the basic parameters of <code>String.prototype.replace()</code></a>.</p>
<h4 id="js-module">JS Module</h4><ul>
<li><p><a href="https://techquery.github.io/AMD_bundle.js/class/source/Package.js~Package.html#instance-method-bundle">API</a></p>
</li>
<li><p><a href="https://github.com/TechQuery/AMD_bundle.js/blob/master/source/index.js#L48">Example 1</a></p>
</li>
<li><p><a href="https://github.com/EasyWebApp/DevCLI/blob/master/source/Component.js#L124">Example 2</a></p>
</li>
</ul>
<h3 id="advanced">Advanced</h3><p>Build <strong>standalone release files</strong> (Full source code, Minimized code &amp; Source map) by executing a single command (<code>npm run build</code>).</p>
<h4 id="multiple-bundles-from-one-source">Multiple bundles from one source</h4><ul>
<li><strong>NPM-scripts</strong> reference: <a href="https://github.com/TechQuery/iQuery.js/blob/master/package.json#L26">iQuery.js</a></li>
</ul>
<h4 id="bundle-ecmascript-6--codes">Bundle ECMAScript 6+ codes</h4><ul>
<li><p>Development dependency: <a href="https://babeljs.io/">Babel</a></p>
</li>
<li><p><strong>NPM-scripts</strong> reference: <a href="https://github.com/EasyWebApp/WebCell/blob/master/package.json#L32">WebCell</a></p>
</li>
</ul>
<h2 id="typical-cases">Typical Cases</h2><ol>
<li><p><a href="https://techquery.github.io/iQuery.js/">iQuery.js</a> (where the prototype of <code>amd-bundle</code> came from)</p>
</li>
<li><p><a href="https://web-cell.tk/">WebCell</a> (where <code>v1.0</code> rewritten out)</p>
</li>
<li><p><a href="https://easywebapp.github.io/DevCLI/">WebCell DevCLI</a> (where <code>v1.3+</code> came out)</p>
</li>
</ol>
<p><a href="https://github.com/TechQuery/AMD_bundle.js/network/dependents">More use case</a></p>
</div>
</div>

<footer class="footer">
  Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>

<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
